<?php
/**********************************************************************//**\file
	Armory Network Transfer

	Description:  A common network transfer class which invokes the
		appropriate transfer method based on configuration data.
*******************************************************************************/

	class armorynet
	{
		protected $pipe; # Network transfer implementation

		public function __construct()
		{
			GLOBAL $config;

			if($config['fetch_method'] == 'fopen')
			{
				$this->pipe = new armorynetfopen();
			}
			elseif($config['fetch_method'] == 'curl')
			{
				$this->pipe = new armorynetcurl();
			}
			elseif($config['fetch_method'] == 'wget')
			{
				$this->pipe = new armorynetwget();
			}
		}

		public function get($url)
		{
			$data = $this->pipe->get($url);

			# Enforce 4 second delay after each request to reduce burst traffic
			# and prevent ip ban (wowarmory specifically)
			sleep(4);

			return $data;
		}
	}
?>
